﻿using PlayMyLife.Events;
using UnityEngine;

namespace PlayMyLife.ViewCommon {
    public abstract class FormBase : MonoBehaviour {
        public EventArgs_ShowPanel Arguments { get; set; }

        public void Open(RectTransform layerRoot) {
            gameObject.transform.SetParent(layerRoot, false);
            gameObject.transform.localScale = Vector3.one;
            gameObject.SetActive(true);
            OnOpen();
        }

        public void Close() {
            OnClose();
            gameObject.SetActive(false);
        }

        protected abstract void OnOpen();
        protected abstract void OnClose();
    }
}
